﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace thinger.MTHProject
{
    public partial class FrmMsgBoxWithOutAck : Form
    {
        public FrmMsgBoxWithOutAck(string tilte, string content)
        {
            InitializeComponent();
            //设置成顶层
            this.TopMost = true;

            this.lblContent.Text = content;

            this.lblTitle.Text = tilte;


        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        #region 无边框拖动
        private Point mPoint;
        private void Panel_MouseDown(object sender, MouseEventArgs e)
        {
            mPoint = new Point(e.X, e.Y);
        }
        private void Panel_MouseMove(object sender, MouseEventArgs e)
        {
            //鼠标左键点击
            if (e.Button == MouseButtons.Left)
            {
                this.Location = new Point(this.Location.X + (e.X - mPoint.X), this.Location.Y + (e.Y - mPoint.Y));
            }

        }
        #endregion


        #region 减少闪烁
        /// <summary>
        /// 将所有的控件一起加载出来，再显示以减少闪烁
        /// </summary>
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;

                cp.ExStyle |= 0x02000000;

                return cp;
            }

        }
        #endregion

        
    }
}
